<script type="text/javascript">

    function validarFecha(form){
        var RegExPattern = /((0[1-9])|(1|2)[0-9]|(3(0|1)))\/(0[1-9]|1[0-2])\/([1-9][0-9][0-9][0-9])/;
        if ((form.fecha.value.match(RegExPattern)) && (form.fecha.value!='')) {
            form.fecha.style.color ="black";
            form.enviar.disabled = false;
        } else {
            form.fecha.style.color ="red";
            form.enviar.disabled = true;
        }
    }

</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <?php include("header.php"); ?>
    <body>
        <?php include("subheader.php"); ?>
        <div id="contentbg">
            <div id="contentblank">
                <div id="content">


                    <?php
                    include("contentleft.php");

                    ?>

                    <div id="contentmid">
                        <div class="midheading">
                            <h2>Zonas de Emergencia</h2>
                        </div>

                        <?php
                        include_once("../FachadaI.php");

                        $fachada = FachadaI::getInstance();
                        $fachada->crearZonaEmergencia($_POST['id'],$_POST['tipo'],$_POST['fecha'],$_POST['data']);

                        ?>
                        <div class="midtxt">
                            <h4 aling = "center">Se agrego la zona de emergencia satisfactoriamente </h4>
                            <br></br>
                            <table border="0" width="450px">
                                <tr><td align="center">
                                        <form>
                                            <input type="button" value="Agregar otra zona"  onclick="location='Formulario_ZonasEmergencia.php'"/>
                                        </form>
                                    </td>
                                </tr>
                            </table>

                        </div>

                        <div class="midtxt">
                            <h4> En esta secci&oacute;n usted podr&aacute; Consultar Zonas de Emergencia.</h4>
                        </div>

                        <div class="midtxt">
                            <form name="f1" method="POST" action="zonaemergenciaconsultada.php">
                                <table border="0" align="center">
                                    <tr>
                                        <td align="center">
                                            <p>Tipo de desastre:</p>
                                        </td>

                                        <td align="center">
                                            <select name="tipo">
                                                <optgroup>
                                                    <option value="Terremoto" selected="selected" align="center">Terremoto</option>
                                                    <option value="Tsunami">Tsunami</option>
                                                    <option value="Incendio">Incendio</option>
                                                    <option value="Inundacion">Inundacion</option>
                                                    <option value="Deslave">Deslave</option>
                                                </optgroup>
                                            </select>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td align="center">
                                            <p>Fecha</p>
                                        </td>
                                        <td align="center">
                                            <input type="text" name="fecha" size="10" maxlength="10" onkeyup="validarFecha(this.form)"/>
                                        </td>
                                    </tr>
                                </table>

                                <table border="0" align="center">
                                    <tr>
                                        <td align="center">
                                            <input type="submit" name="enviar" value="Consultar Zonas" disabled/>
                                        </td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </div>

                    <?php include("contentright.php");?>
                </div>
            </div>
        </div>
        <?php include("footer.php");?>
    </body>
</html>